// https://leetcode.cn/problems/build-an-array-with-stack-operations/
// Created by ade on 2022/10/19.
//

class Solution {
public:
    vector <string> buildArray(vector<int> &target, int n) {
        vector <string> res = {};
        int index = 1;
        for (auto &i : target) {
            while (i != index) {
                res.push_back("Push");
                res.push_back("Pop");
                index++;
            }
            if (i == index) {
                res.push_back("Push");
                index++;
            }
        }
        return res;
    }
};